import Vue from "vue"
import axios from "axios"

import Cookies from "js-cookie"

import "normalize.css/normalize.css" // a modern alternative to CSS resets

import Element from "element-ui"
import "./styles/element-variables.scss"

import "@/styles/index.scss" // global css
import "@/assets/scss/index.scss"

import App from "./App"
import store from "./store"
import router from "./router"

import "./icons" // icon
import "./permission" // permission control
import "./utils/error-log" // error log

import * as filters from "./filters" // global filters

import inject from "@/plugins/inject"
import VueSignalR from "@latelier/vue-signalr"

import "@/utils/setUrl.js"
import "@/utils/timeFormat.js"

Vue.use(inject)

Vue.use(Element, {
  size: Cookies.get("size") || "medium", // set element-ui default size
})
if (!process.env.IS_WEB) Vue.use(require("vue-electron"))
Vue.http = Vue.prototype.$http = axios

// register global utility filters
Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true"
Vue.use(VueSignalR, "http://123.183.159.70:9198/notifications")
new Vue({
  el: "#app",
  router,
  store,

  created() {
    this.$socket.start({
      log: true, // Active only in development for debugging.
    })
  },
  render: (h) => h(App),
})
